  $(document).ajaxSend(function(event, xhr, options){
        xhr.setRequestHeader("token",localStorage.getItem("token"));
    });
$(document).ajaxError(function(event,xhr,options,exc){
    if(xhr.status == 401){
        alert("请先登录");
        location.assign("blog_login.html");
    }
});





function logout() {
 //删除Cookie, 设置Cookie为空即可 
 localStorage.removeItem("user_token");
 location.href = "/blog_login.html";
}